/**
 * Copyright:Copyright(c)2014-2015
 * Company:厦门市易致达物联网科技有限公司
 * @version 1.0
 */
package shop.services.manage.nature.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import shop.core.ServicesManager;
import shop.services.manage.nature.NatureService;
import shop.services.manage.nature.bean.Nature;
import shop.services.manage.nature.dao.NatureDao;

import javax.annotation.Resource;


/**   
 * @类名称：NatureServiceImpl      
 * @创建人：Ltz   
 * @创建时间：2017-10-14 下午21:06:41        
 * @版本号：1.0
 * @描述：     
 */
@Service("natureServiceManage")
public class NatureServiceImpl extends ServicesManager<Nature, NatureDao> implements
NatureService {
    @Resource(name = "natureDaoManage")
    @Override
    public void setDao(NatureDao natureDao) {
    this.dao = natureDao;
    }

    public int deleteByPID(int id) {
        return dao.deleteByPID(id);
    }

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    public int deletesByPID(String[] ids) {
        if (ids == null || ids.length == 0) {
            throw new NullPointerException("id不能全为空！");
        }

        for (int i = 0; i < ids.length; i++) {
            if(StringUtils.isBlank(ids[i])){
                throw new NullPointerException("id不能为空！");
            }
            dao.deleteByPID(Integer.parseInt(ids[i]));
        }
        return 0;
    }

    /**
    * 根据参数名称删除商品参数
    * */
    public int deleteByName(String name) {
        return dao.deleteByName(name);
    }


}

